package com.collect.tanzania.zhiBean.zhiReceive;

import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.ForegroundColorSpan;

import com.collect.tanzania.R;
import com.collect.tanzania.MyApplication;
import com.collect.tanzania.zhiUtils.StringUtil;

import java.io.Serializable;

public class ZHIRTelemarketingFollowEntity implements Serializable {
    private String followId;

    private String assignDate;
    private String mobile;
    private String targetProduct;
    private String lastFollowTime;
    private String lastFollowContent;
    private String followNum;
    private String fullName;
    private String whatsAppContent;

    private String clientType;
    private String followStatus;
    private String whatsappFollowNum;

    private String IMPORT_TYPE;
    private String USER_STEP;
    private String NEXT_LOAN_AMOUNT;
    private String IMPORT_USER_TYPE;

    public String getAssignDate() {
        return StringUtil.safeString(assignDate);
    }

    public void setAssignDate(String assignDate) {
        this.assignDate = assignDate;
    }

    public String getMobile() {
        return StringUtil.safeString(mobile);
    }

    public String getMobileEncryptFormatter() {
        return StringUtil.phoneNumberEncryptFormatter(mobile);
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getTargetProduct() {
        return StringUtil.safeString(targetProduct);
    }

    public void setTargetProduct(String targetProduct) {
        this.targetProduct = targetProduct;
    }

    public String getLastFollowTime() {
        return StringUtil.safeString(lastFollowTime);
    }

    public void setLastFollowTime(String lastFollowTime) {
        this.lastFollowTime = lastFollowTime;
    }

    public String getLastFollowContent() {
        return StringUtil.safeString(lastFollowContent);
    }

    public SpannableStringBuilder getRemarkSpanFormat() {

        String line0 = "Remark: ";
        String line1 = getLastFollowContent();
        String fullLine = line0 + line1;

        SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(fullLine);
        spannableStringBuilder.setSpan(new ForegroundColorSpan(MyApplication.getAppContext().getResources().getColor(R.color.theme_black_2)), 0, line0.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
        spannableStringBuilder.setSpan(new ForegroundColorSpan(MyApplication.getAppContext().getResources().getColor(R.color.theme_color_0)), line0.length(), fullLine.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);

        spannableStringBuilder.setSpan(new AbsoluteSizeSpan(12, true), 0, line0.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
        spannableStringBuilder.setSpan(new AbsoluteSizeSpan(14, true), line0.length(), fullLine.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE);

        return spannableStringBuilder;
    }

    public void setLastFollowContent(String lastFollowContent) {
        this.lastFollowContent = lastFollowContent;
    }

    public String getFollowNum() {
        return StringUtil.safeString(followNum);
    }

    public void setFollowNum(String followNum) {
        this.followNum = followNum;
    }

    public String getFullName() {
        return StringUtil.safeString(fullName);
    }

    public void setFullName(String fullName) {
        this.fullName = fullName;
    }

    public String getWhatsAppContent() {
        return whatsAppContent;
    }

    public void setWhatsAppContent(String whatsAppContent) {
        this.whatsAppContent = whatsAppContent;
    }

    public String getFollowId() {
        return followId;
    }

    public void setFollowId(String followId) {
        this.followId = followId;
    }

    public String getClientType() {
        return StringUtil.safeString(clientType);
    }

    public void setClientType(String clientType) {
        this.clientType = clientType;
    }

    public String getFollowStatus() {
        return StringUtil.safeString(followStatus);
    }

    public void setFollowStatus(String followStatus) {
        this.followStatus = followStatus;
    }

    public String getWhatsappFollowNum() {
        return StringUtil.safeString(whatsappFollowNum);
    }

    public int getWhatsappFollowNumInt() {
        try {
            return Integer.parseInt(getWhatsappFollowNum());
        } catch (Exception e) {
            e.printStackTrace();
        }
        return 0;
    }

    public void setWhatsappFollowNum(String whatsappFollowNum) {
        this.whatsappFollowNum = whatsappFollowNum;
    }

    public String getIMPORT_TYPE() {
        if (TextUtils.isEmpty(IMPORT_TYPE)) return "";

        if (IMPORT_TYPE.equalsIgnoreCase("REGISTER_NOT_APPLY")) {
            return "Registered without Application";
        }

        if (IMPORT_TYPE.equalsIgnoreCase("SETTLE_NOT_RELOAN")) {
            return "Loan Repaid but Not Renewed";
        }

        if (IMPORT_TYPE.equalsIgnoreCase("WHITE_LIST")) {
            return "Whitelist";
        }

        if (IMPORT_TYPE.equalsIgnoreCase("OUTSIDE_IMPORT_LIST")) {
            return "External Traffic List";
        }

        return IMPORT_TYPE;
    }

    public void setIMPORT_TYPE(String IMPORT_TYPE) {
        this.IMPORT_TYPE = IMPORT_TYPE;
    }

    public String getUSER_STEP() {
        return USER_STEP;
    }

    public void setUSER_STEP(String USER_STEP) {
        this.USER_STEP = USER_STEP;
    }

    public String getNEXT_LOAN_AMOUNT() {
        return NEXT_LOAN_AMOUNT;
    }

    public void setNEXT_LOAN_AMOUNT(String NEXT_LOAN_AMOUNT) {
        this.NEXT_LOAN_AMOUNT = NEXT_LOAN_AMOUNT;
    }

    public String getIMPORT_USER_TYPE() {
        return StringUtil.safeString(IMPORT_USER_TYPE);
    }

    public void setIMPORT_USER_TYPE(String IMPORT_USER_TYPE) {
        this.IMPORT_USER_TYPE = IMPORT_USER_TYPE;
    }

    public boolean isGoodUser() {
        return getIMPORT_USER_TYPE().equalsIgnoreCase("GOODUSER");
    }
}
